﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit" xmlns:layoutPrimitivesToolkit="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Layout.Toolkit">

    <Style x:Key="AccordionItemStyle" TargetType="layoutToolkit:AccordionItem">
    	<Setter Property="Background" Value="{x:Null}"/>
    	<Setter Property="BorderBrush" Value="{x:Null}"/>
    </Style>

    <ControlTemplate TargetType="layoutPrimitivesToolkit:AccordionButton" x:Key="AccordionHeaderTemplate">
        <Grid Background="Transparent" Margin="0">
    		<VisualStateManager.VisualStateGroups>
    			<VisualStateGroup x:Name="ExpansionStates">
    				<VisualStateGroup.Transitions>
    					<VisualTransition GeneratedDuration="0"/>
    				</VisualStateGroup.Transitions>
    				<VisualState x:Name="Collapsed">
    					<Storyboard/>
    				</VisualState>
    				<VisualState x:Name="Expanded">
    					<Storyboard>
    						<Storyboard>
    							<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0080000" Storyboard.TargetName="background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
    								<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFb6b6b6"/>
    							</ColorAnimationUsingKeyFrames>
    						</Storyboard>
    					</Storyboard>
    				</VisualState>
    			</VisualStateGroup>
    			<VisualStateGroup x:Name="CheckStates">
    				<VisualStateGroup.Transitions>
    					<VisualTransition GeneratedDuration="00:00:00"/>
    				</VisualStateGroup.Transitions>
    				<VisualState x:Name="Checked" />
    				<VisualState x:Name="Unchecked"/>
    				<VisualState x:Name="Indeterminate"/>
    			</VisualStateGroup>
    			<VisualStateGroup x:Name="CommonStates">
    				<VisualStateGroup.Transitions>
    					<VisualTransition GeneratedDuration="0"/>
    					<VisualTransition GeneratedDuration="00:00:00.1" From="MouseOver" To="Normal"/>
    					<VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/>
    					<VisualTransition GeneratedDuration="00:00:00.1" To="Pressed"/>
    				</VisualStateGroup.Transitions>
    				<VisualState x:Name="Normal"/>
    				<VisualState x:Name="MouseOver"/>
    				<VisualState x:Name="Pressed">
    					<Storyboard/>
    				</VisualState>
    				<VisualState x:Name="Disabled">
    					<Storyboard/>
    				</VisualState>
    			</VisualStateGroup>
    			<VisualStateGroup x:Name="FocusStates">
    				<VisualState x:Name="Focused">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
    							<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
    						</ObjectAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualState>
    				<VisualState x:Name="Unfocused"/>
    			</VisualStateGroup>
    			<VisualStateGroup x:Name="ExpandDirectionStates">
    				<VisualState x:Name="ExpandDown"/>
    				<VisualState x:Name="ExpandUp"/>
    				<VisualState x:Name="ExpandLeft"/>
    				<VisualState x:Name="ExpandRight"/>
    			</VisualStateGroup>
    		</VisualStateManager.VisualStateGroups>
    		<Border x:Name="MouseOverBackground"
    			BorderBrush="{TemplateBinding BorderBrush}" 
    			BorderThickness="{TemplateBinding BorderThickness}" >
    			<Border x:Name="background" Background="#7F000000">
        			
    				<ContentControl x:Name="header"
    					Grid.Column="1" Grid.Row="0"
    					Content="{TemplateBinding Content}" 
    					ContentTemplate="{TemplateBinding ContentTemplate}" 
    					Foreground="{TemplateBinding Foreground}"
    					HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
    					VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
        			
    			</Border>
    		</Border>
            
            
    		<Rectangle x:Name="FocusVisualElement"
    			IsHitTestVisible="false" 
    			StrokeDashArray="1 2" 
    			StrokeThickness="1" Visibility="Collapsed"/>
    	</Grid>
    </ControlTemplate>

    <ControlTemplate TargetType="layoutToolkit:AccordionItem" x:Key="AccordionItemTemplate">
        <Grid x:Name="grid" Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="ExpansionStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Collapsed">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames
                						BeginTime="00:00:00"
                						Storyboard.TargetName="ExpandSite"
                						Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Expanded">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames
                						BeginTime="00:00:00"
                						Storyboard.TargetName="ExpandSite"
                						Storyboard.TargetProperty="(ExpandableContentControl.Percentage)">
                                <SplineDoubleKeyFrame
                							KeyTime="00:00:00.3"
                							KeySpline="0.2,0,0,1"
                							Value="1" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="LockedStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0"/>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Locked">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="IsEnabled">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="False"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unlocked">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="IsEnabled">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="True"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" 
                		Background="{TemplateBinding Background}" 
                		BorderBrush="{TemplateBinding BorderBrush}" 
                		BorderThickness="{TemplateBinding BorderThickness}">
                <Grid>
                    <Grid.RowDefinitions >
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <layoutPrimitivesToolkit:AccordionButton
                				Template="{StaticResource AccordionHeaderTemplate}"
                				x:Name="ExpanderButton"
                				Content="{TemplateBinding Header}"
                				ContentTemplate="{TemplateBinding HeaderTemplate}"
                				IsChecked="{TemplateBinding IsSelected}"
                				Grid.Column="0"
                				Grid.ColumnSpan="2"
                				Grid.Row="0"
                				Padding="4"
                				Margin="0"
                				FontFamily="{TemplateBinding FontFamily}"
                				FontSize="14"
                				FontStretch="{TemplateBinding FontStretch}"
                				FontStyle="{TemplateBinding FontStyle}"
                				Foreground="#F6F5F3"
                				HorizontalContentAlignment="Left"
                				VerticalContentAlignment="Center" />
                    <layoutPrimitivesToolkit:ExpandableContentControl
                				x:Name="ExpandSite"
                				Grid.Column="0"
                				Grid.ColumnSpan="2"
                				Grid.Row="1"
                				Percentage="0"
                				Background="#FFB6B6B6"
                				RevealMode="{TemplateBinding ExpandDirection}"
                				Content="{TemplateBinding Content}"
                				ContentTemplate="{TemplateBinding ContentTemplate}"
                				Padding="0"
                				Margin="0"
                				FontFamily="{TemplateBinding FontFamily}"
                				FontSize="12"
                				FontStretch="{TemplateBinding FontStretch}"
                				FontStyle="{TemplateBinding FontStyle}"
                				FontWeight="{TemplateBinding FontWeight}"
                				Foreground="#FFFFFFFF"
                				HorizontalAlignment="Stretch"
                				HorizontalContentAlignment="Left"
                				VerticalAlignment="Stretch"
                				VerticalContentAlignment="Top" />
                </Grid>
            </Border>
            <Border x:Name="DisabledVisualElement" IsHitTestVisible="false" Opacity="0"/>
            <Border x:Name="FocusVisualElement" IsHitTestVisible="false"  BorderThickness="0"/>
        </Grid>
    </ControlTemplate>

</ResourceDictionary>
